package com.shenmazong.serverswaggerdemo2.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: server-java-demo
 * @description: UserController
 * @author: 亮子说编程
 * @create: 2020-10-22 18:31
 **/

@RestController
@Slf4j
@CrossOrigin
@Api(tags = "接口-用户管理接口")
public class UserController {

    @PostMapping(value = "/addAdminUser")
    @ApiOperation(value = "添加管理员", notes = "系统添加管理员")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userName", value = "登录账号", dataType = "String", required = true),
            @ApiImplicitParam(name = "userPass", value = "登录密码", dataType = "String", required = true)
    })
    public String addAdminUser(@RequestParam("userName") String userName,
                               @RequestParam("userPass") String userPass) {
        return "add";
    }

    @PostMapping(value = "/delAdminUser")
    @ApiOperation(value = "删除管理员", notes = "删除管理员")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userId", value = "管理员ID", dataType = "int", required = true, example = "0")
    })
    public String delAdminUser(@RequestParam("userId") Integer userId) {
        return "delete";
    }

    @PostMapping(value = "/setAdminPass")
    @ApiOperation(value = "重置管理员密码", notes = "重置管理员密码")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "userId", value = "管理员ID", dataType = "int", required = true, example = "0"),
            @ApiImplicitParam(name = "userPass", value = "管理员密码", dataType = "String", required = true, example = "123456")
    })
    public String setAdminPass(@RequestParam("userId") Integer userId,
                                       @RequestParam("userPass") String userPass) {
        return "setAdminPass";
    }
}
